<template>
  <div
    class="exhibits-content"
    :style="{ width: props.info.width - 0.2 + 'rem', height: props.info.height - 0.2 + 'rem' }"
  >
    <draggableChildItem
      :selectInfo="props.selectInfo"
      :AuxiliaryId="(props.AuxiliaryId || props.AuxiliaryId === 0) && props.AuxiliaryId !== -1"
      :childId="props.childId"
      @emitChildDraggable="emitChildItemDraggable"
      @emitChildDraggableStyle="emitChildItemDraggableStyle"
      v-for="(item, index) in props.info.showpieceList"
      :info="item"
      :list="props.info.showpieceList"
      :key="index"
      :index="index"
      :parentIndex="props.indexs"
    />
    <draggableShowcase
      :width="props.info.width - 0.2"
      v-if="props.childShow"
      :selectInfo="props.selectInfo"
      :AuxiliaryId="props.AuxiliaryId"
      :info="props.info"
      @emitShowcaseDraggable="emitShowcaseDraggable"
      @emitShowcaseDraggableStyle="emitShowcaseDraggableStyle"
    />
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'style4',
});
</script>

<script setup lang="ts">
import draggableShowcase from '@/freeComponents/Showcase/draggableShowcase.vue'; //展柜
import { DraggableContainer } from 'vue3-draggable-resizable';
import draggableChildItem from './draggableChildItem.vue';
import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick, defineComponent } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { publicUrls } from '@/utils/minxin';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const fanList = ref(0);
const timer = ref();

const props = defineProps({
  childShow: {
    type: Boolean,
  },
  selectInfo: {
    type: Object,
  },
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});
const emitChildItemDraggable = (draggingInfo: any, childIndex: number) => {
  emit('emitChildItemDraggable', draggingInfo, childIndex); //分组传递当前展品图距离相对父元素的xy偏移量变化
};
const emitChildItemDraggableStyle = (draggingInfo: any, childIndex: number) => {
  emit('emitChildItemDraggableStyle', draggingInfo, childIndex); //分组设置当前展品图距离相对父元素的宽高变化
};
const emitShowcaseDraggable = (draggingInfo: any) => {
  emit('emitShowcaseDraggable', draggingInfo); //传递当前展柜图距离相对父元素的xy偏移量变化
};
const emitShowcaseDraggableStyle = (draggingInfo: any) => {
  emit('emitShowcaseDraggableStyle', draggingInfo); //传递当前展柜距离相对父元素的宽高变化
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
  // padding: 10px;
  -webkit-box-reflect: below -13% linear-gradient(transparent, rgba(0, 0, 0, 0.15));
}
.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}

:deep(.hovered) {
  border: 1px solid transparent;
}
</style>
